package helper

import (
	"gitee.com/yangguoliang001/go-gin-vue3/services/helperService"
	"github.com/gin-gonic/gin"
	"github.com/go-redis/redis/v7"
	"go.uber.org/zap"
	"gorm.io/gorm"
)

type Controller interface {
	SearchCache(c *gin.Context)
	ClearCache(c *gin.Context)
	//	db 操作
	QueryDbs(c *gin.Context)
	QueryTables(c *gin.Context)
	SearchMysql(c *gin.Context)
}

type helperController struct {
	logger        *zap.Logger
	cache         *redis.Client
	helperService helperService.HelperService
}

func New(logger *zap.Logger, db *gorm.DB, cache *redis.Client) Controller {
	return &helperController{
		logger:        logger,
		cache:         cache,
		helperService: helperService.New(db, cache, logger),
	}
}
